10 ' juliadem.bas - FreeWare 2005
20 GOTO 60 ' begin
30 'SAVE"juliadem.bas",A:LIST-60
40 GOTO 620 ' wait for key
50 GOTO 650 ' centered text
60 SCREEN 12:CLS:DEFSTR M,Q:Q=MKI$(0)
70 WINDOW (-320,-240)-(319,239)
80 DIM COL(8):DATA 0,1,9,2,10,4,12,6,14
90 FOR I=0 TO 8:READ COL(I):NEXT
100 M(1)="JULIA Designs idea from Hans Lauwerier"
110 M(2)="GWBasic by Eric Tchong"
120 M(3)="Choose 1..6   -1 = stop program "
130 FOR I=1 TO 3
140  GOSUB 50
150  IF I=2 THEN PRINT
160 NEXT
170 LOCATE 5,30:INPUT CH
180 IF CH=-1 THEN SCREEN 0,0,0:CLS:END
190 IF CH<1 OR CH>6 THEN 170
200 ' select
210 CLS:ON CH GOTO 230,260,290,320,350,380
220 REM case 1
230 A=-1.029:B=.3863:DELH=2:DELV=1.2
240 KMAX=100:N1=240:P=1:GOTO 410
250 REM case 2
260 A=-.75:B=0:DELH=1.8:DELV=1.2
270 KMAX=50:N1=240:P=1:GOTO 410
280 REM case 3
290 A=-.7454:B=.1103:DELH=1.6:DELV=1
300 KMAX=200 :N1=200:P=5:GOTO 410
310 REM case 4
320 A=-.55:B=0:DELH=1.6:DELV=1.2
330 KMAX=100:N1=200:P=1:GOTO 410
340 REM case 5
350 A=-.1226:B=.7449:DELH=1.7:DELV=1.5
360 KMAX=100 :N1=180:P=1:GOTO 410
370 REM case 6
380 A=.1:B=.3:DELH=1.5:DELV=1.5:KMAX=50
390 KMAX=100:N1=160:P=1
400 ' generate fractal
410 N2=INT(N1*DELV/DELH)
420 IF B=0 THEN N3=0 ELSE N3=N2
430 FOR I=0 TO N1
440  FOR J=-N3 TO N2
450   IF INKEY$<>"" THEN 600
460   X=I*DELH/N1:Y=J*DELV/N2
470   FOR K=1 TO KMAX
480    X1=X*X-Y*Y+A:Y1=2*X*Y+B
490    S=X*X+Y*Y:S1=(X-X1)*(X-X1)+(Y-Y1)*(Y-Y1)
500    IF S>1000   THEN L=1+INT(K/P) MOD 8:K=2004:GOTO 530
510    IF S1<.0001 THEN L=1+INT(K/P) MOD 8:K=2004:GOTO 530
520    X=X1:Y=Y1
530   NEXT
540   IF K=2005 THEN 560
550   L=0
560   PSET (I,J),COL(L):PSET (-I,-J),COL(L)
570   IF B=0 THEN PSET (I,-J),COL(L):PSET (-I,J),COL(L)
580  NEXT
590 NEXT
600 GOSUB 40:CLS:GOTO 130
610 ' wait for key
620 LSET Q=MKI$(0)
630 WHILE CVI(Q)=0:MID$(Q,1)=INKEY$:WEND:RETURN
640 ' centered text
650 X=(80-LEN(M(I)))/2
660 PRINT TAB(X) M(I):RETURN
